xen/arm64: head: Introduce get_table_slot() and use it
authorJulien Grall <jgrall@amazon.com>
Fri, 12 Aug 2022 19:24:41 +0000 (20:24 +0100)
committerJulien Grall <julien@xen.org>
Wed, 31 Aug 2022 19:16:04 +0000 (20:16 +0100)
commit0f94a5a7fb5fbf50979227b54f82577f8bb51b65
tree4766c5a94ade517cbecb4dca1218bdf07dbec861
parent471721c341cb56487324410f501b7f012d313e0e
xen/arm64: head: Introduce get_table_slot() and use it

There are a few places in the code that need to find the slot
at a given page-table level.

So create a new macro get_table_slot() for that. This will reduce
the effort to figure out whether the code is doing the right thing.

Take the opportunity to use 'ubfx'. The only benefits is reducing
the number of instructions from 2 to 1.

The new macro is used everywhere we need to compute the slot. This
requires to tweak the parameter of create_table_entry() to pass
a level rather than shift.

Note, for slot 0 the code is currently skipping the masking part. While
this is fine, it is safer to mask it as technically slot 0 only covers
bit 48 - 39 bit (assuming 4KB page granularity).

Take the opportunity to correct the comment when finding the second
slot for the identity mapping (we are computing the second slot
rather than first).

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Wei Chen <Wei.Chen@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
xen/arch/arm/arm64/head.S